﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace ECCSystem.DataAccess
{
	class ClsOverTimeBill : DBObject 
    {
		public DataSet GetOverTimeBill()
		{
			return RunProcedure("sp_OvertimeBill_GetList", new IDataParameter[] { }, "OvertimeBill");
		}

		public DataSet GetOverTimeBill(DateTime objDateTime)
		{
			SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Time", SqlDbType.DateTime) };

			parameters[0].Value = objDateTime;

			return RunProcedure("sp_OvertimeBill_GetListByDate", parameters, "OvertimeBill");
		}

		public void AddOverTimeBill(DateTime dtStartTime, DateTime dtEndTime,string strUserName, string strUserID)
        {
			SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@StartTime", SqlDbType.DateTime),
															 new SqlParameter("@EndTime", SqlDbType.DateTime),
															 new SqlParameter("@UserName", SqlDbType.NVarChar,1000),
															 new SqlParameter("@UserID", SqlDbType.VarChar,1000)};

			parameters[0].Value = dtStartTime;
			parameters[1].Value = dtEndTime;
			parameters[2].Value = strUserName;
			parameters[3].Value = strUserID;
			this.RunProcedure("sp_OvertimeBill_Add", parameters, "OverTimeBill");
        }

		public void DeleteOverTimeBill(string strID)
		{
			SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.VarChar,11) };
			parameters[0].Value = strID;
			this.RunProcedure("sp_OvertimeBill_Delete", parameters, "OvertimeBill");
		}

		public void UpdateOverTimeBill(string strID, DateTime dtStartTime, DateTime dtEndTime, string strUserName, string strUserID)
		{
			SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.VarChar,11),
															 new SqlParameter("@StartTime", SqlDbType.DateTime),
															 new SqlParameter("@EndTime", SqlDbType.DateTime),
															 new SqlParameter("@UserName", SqlDbType.NVarChar,1000),
															 new SqlParameter("@UserID", SqlDbType.VarChar,1000)};

			parameters[0].Value = strID;
			parameters[1].Value = dtStartTime;
			parameters[2].Value = dtEndTime;
			parameters[3].Value = strUserName;
			parameters[4].Value = strUserID;
			this.RunProcedure("sp_OvertimeBill_Update", parameters, "OvertimeBill");
		}
    }
}
